package com.cloud.demo2020;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cloud.demo2020.common.ResultBean;
import com.cloud.demo2020.entity.SysToken;
import com.cloud.demo2020.mapper.SysTokenMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private SysTokenMapper sysTokenMapper;

    @Override
    public ResultBean info(String token) {
        SysToken item = this.sysTokenMapper.selectOne(
                new QueryWrapper<SysToken>().eq("token", token));
        if (item == null) {
            System.out.println("token为空");
            return new ResultBean(false, "非法输入,请校验token");
        }
        return new ResultBean(item);
    }
}
